{include file="common/_meta" /}
<title>新增下载 - 资讯管理 </title>
<meta name="keywords" content="李志立，lizhilimaster@163.com">
<meta name="description" content="李志立，lizhilimaster@163.com">
</head>
<body>
	<article class="page-container" style="padding-left: 100px !important;">
		<form class="form form-horizontal" enctype="multipart/form-data" action="" method="post" id="form-article-add">
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>下载标题：</label>
				<div class="formControls col-xs-9 col-sm-9">
					<input type="text" class="input-text" value="" placeholder="请输入下载标题" id="title" name="title">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2">关键词：</label>
				<div class="formControls col-xs-9 col-sm-9">
					<input type="text" class="input-text" value="" placeholder="请输入关键词" id="keyword" name="keyword">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2">设置时间：</label>
				<div class="formControls col-xs-9 col-sm-9">
					<input type="datetime-local" value="" name="create_time" placeholder="默认不填写,为真实时间" class="input-text">
				</div>
			</div>
			<div class="row cl wenzhang">
				<label class="form-label col-xs-3 col-sm-2">下载摘要：</label>
				<div class="formControls col-xs-9 col-sm-9">
					<textarea name="desc" cols="" rows="" id="desc" class="textarea" placeholder="说点什么..."  onKeyUp="textlength()"></textarea>
					<p class="textarea-numberbar"><em class="textarea-length">0</em>/200</p>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2">展示数据：</label>
				<div class="formControls col-xs-9 col-sm-9">
					<input type="number" class="input-text" value="<?php echo mt_rand(500,2000); ?>" placeholder=""  name="click_wai" style="width: 30%;"> 随机生成500-2000 之间的数字
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2">下载来源：</label>
				<div class="formControls col-xs-9 col-sm-9">
					<input type="text" class="input-text" value="" placeholder=""  name="laiyuan">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2">下载作者：</label>
				<div class="formControls col-xs-9 col-sm-9">
					<input type="text" class="input-text" value="" placeholder=""  name="author">
				</div>
			</div>
			
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2">设为推荐：</label>
				<div class="formControls col-xs-9 col-sm-9">
					<div class="switch" data-on-label="开" data-off-label="关">
						<input type="checkbox" name="is_tui" />
					</div>
				</div>
			</div>
			<div class="row cl wenzhang">
				<label class="form-label col-xs-3 col-sm-2">缩略图：</label>
				<div class="formControls col-xs-9 col-sm-9">
					<div class="uploader-thum-container">
						<a href="javascript:void();" class="btn btn-primary radius"><i class="icon Hui-iconfont">&#xe642;</i> 浏览文件</a>
						<input type="file" class="input-file" onchange='onpic(this)' name="pic"  value="" accept='image/*' style="font-size: 20px;left:0;" /><span
						 class="sp"></span>
					</div>
				</div>
			</div>
			<div class="row cl wenzhang">
				<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>上传附件：</label>
				<div class="formControls col-xs-9 col-sm-9">
					<div class="uploader-thum-container">
						<a href="javascript:void();" class="btn btn-primary radius"><i class="icon Hui-iconfont">&#xe642;</i> 浏览文件</a>
						<input type="file" class="input-file" onchange='onpic(this)' name="file"  value="" accept='*/*' style="font-size: 20px;left:0;" /><span
						 class="sp"></span>
					</div>
				</div>
			</div>
			
			<div class="row cl">
				<label class="form-label col-xs-3 col-sm-2"><span class="c-red">*</span>详细内容：</label>
				<div class="formControls col-xs-9 col-sm-9">
					<script id="editor" name='text' type="text/plain" style="width:100%;height:400px;"></script>
				</div>
			</div>
			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
					<button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i>&nbsp;&nbsp;提交</button>
				</div>
			</div>
		</form>
	</article>
	{include file="common/_footer" /}
	<style type="text/css">
		.li123 {
			line-height: 30px;
			background: burlywood;
			display: inline-block;
			vertical-align: middle;
			padding: 0 8px;
		}
		#abtn,.dtbtn{
			color: red;
		}
	</style>
	<script type="text/javascript" src="__MANAGE__lib/jquery.validation/1.14.0/jquery.validate.js"></script>
	<script type="text/javascript" src="__MANAGE__lib/jquery.validation/1.14.0/validate-methods.js"></script>
	<script type="text/javascript" src="__MANAGE__lib/jquery.validation/1.14.0/messages_zh.js"></script>
	<script type="text/javascript" src="__MANAGE__lib/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" src="__MANAGE__lib/ueditor/ueditor.all.min.js"> </script>
	<script type="text/javascript" src="__MANAGE__lib/ueditor/lang/zh-cn/zh-cn.js"></script>
	<script type="text/javascript">
		$(function() {
			$('.skin-minimal input').iCheck({
				checkboxClass: 'icheckbox-blue',
				radioClass: 'iradio-blue',
				increaseArea: '20%'
			});
				let wo=$("#form-article-add").validate({
					rules: {
						title: {
							required: true,
						},
						file: {
							required: true,
						},
						text: {
							required: true,
						},
					},
					submitHandler:function(form) {
						$("input[type=\"submit\"]").addClass('disabled').attr("disabled",true);
						var index = layer.load(1, {
							shade: [0.1,'#fff'] //0.1透明度的白色背景
						});
						setTimeout(()=>{
							$("input[type=\"submit\"]").removeClass('disabled').attr("disabled",false);
							layer.close(index);
						},1000)
						form.submit();
					}
				});
			var ue = UE.getEditor('editor');
		});
		function textlength() {
			var nmb = $('#desc').val().length;
			$('.textarea-length').text(nmb);
			if(nmb>200){
				$('#desc').css("background-color","orangered");
				$('#desc').val($('#desc').val().substr(0,200));
				$('.textarea-length').text(200);
			}else{
				$('#desc').css("background-color","white");
				$('.textarea-length').text(nmb);
			}
		}
		function onpic(e) {
			$(e).parent().find('.sp').html(e.files[0].name).addClass('li123');
		}
	</script>
</body>
</html>
